<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
pageContext.setAttribute("baseUrl",basePath);
%>

<script type="text/javascript">
/*传入对应file控件对象*/
function upload(obj){
		var dataUrl='';
		var formData = new FormData();
		formData.append("file",$(obj)[0].files[0]);
		formData.append("name",$(obj).attr("name"));
		$.ajax({ 
			url : "${baseUrl}/file/upload", 
			type : 'POST', 
			data : formData,
			async: false,
			// 告诉jQuery不要去处理发送的数据

			processData : false, 
			// 告诉jQuery不要去设置Content-Type请求头

			contentType : false,
			enctype:"multipart/form-data",
			success : function(result) {
				dataUrl=result;
			}, 
			error : function(result) { 
			} 
			}); 
		return dataUrl;
	}
</script>
<%-- <base href="<%=basePath%>"> --%>